package com.trade.model;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author Lin Yang
 * 
 */
public class ProcurmentContract implements Serializable {
    public static final String Date_FORMAT = "yyyy-MM-DD-HH:mm:ss";
    private static final long serialVersionUID = 1L;

    public static final int STATE_SUBMIT = 0;
    public static final int STATE_APPROVE = 1;
    public static final int STATE_COMPLETE = 2;

    private long id;
    private String name;
    private long goodsId;
    private String goodsName;
    private String content;
    private long contractTime;
    private String buyerLoginName;
    private String buyerName;
    private long approveTime;
    private String approverLoginName;
    private String approverName;
    private long verifyTime;
    private String verifierLoginName;
    private String verifierName;
    private long supplierId;
    private String supplierName;
    private long goodsNumber;
    private double goodsPrice;
    private double totalCost;
    private int state;

    public ProcurmentContract() {
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public long getGoodsId() {
        return goodsId;
    }

    public void setGoodsId(long goodsId) {
        this.goodsId = goodsId;
    }

    public String getGoodsName() {
        return goodsName;
    }

    public void setGoodsName(String goodsName) {
        this.goodsName = goodsName;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public long getContractTime() {
        return contractTime;
    }

    public String getContractTimeStr() {
        if (contractTime > 0) {
            SimpleDateFormat f = new SimpleDateFormat(Date_FORMAT);
            return f.format(new Date(contractTime));
        } else {
            return "";
        }
    }

    public void setContractTime(long contractTime) {
        this.contractTime = contractTime;
    }

    public String getBuyerLoginName() {
        return buyerLoginName;
    }

    public void setBuyerLoginName(String buyerLoginName) {
        this.buyerLoginName = buyerLoginName;
    }

    public String getBuyerName() {
        return buyerName;
    }

    public void setBuyerName(String buyerName) {
        this.buyerName = buyerName;
    }

    public long getApproveTime() {
        return approveTime;
    }

    public String getApproveTimeStr() {
        if (approveTime > 0) {
            SimpleDateFormat f = new SimpleDateFormat(Date_FORMAT);
            return f.format(new Date(approveTime));
        } else {
            return "";
        }
    }

    public void setApproveTime(long approveTime) {
        this.approveTime = approveTime;
    }

    public String getApproverLoginName() {
        return approverLoginName;
    }

    public void setApproverLoginName(String approverLoginName) {
        this.approverLoginName = approverLoginName;
    }

    public String getApproverName() {
        return approverName;
    }

    public void setApproverName(String approverName) {
        this.approverName = approverName;
    }

    public long getVerifyTime() {
        return verifyTime;
    }

    public String getVerifyTimeStr() {
        if (verifyTime > 0) {
            SimpleDateFormat f = new SimpleDateFormat(Date_FORMAT);
            return f.format(new Date(verifyTime));
        } else {
            return "";
        }
    }

    public void setVerifyTime(long verifyTime) {
        this.verifyTime = verifyTime;
    }

    public String getVerifierLoginName() {
        return verifierLoginName;
    }

    public void setVerifierLoginName(String verifierLoginName) {
        this.verifierLoginName = verifierLoginName;
    }

    public String getVerifierName() {
        return verifierName;
    }

    public void setVerifierName(String verifierName) {
        this.verifierName = verifierName;
    }

    public long getSupplierId() {
        return supplierId;
    }

    public void setSupplierId(long supplierId) {
        this.supplierId = supplierId;
    }

    public String getSupplierName() {
        return supplierName;
    }

    public void setSupplierName(String supplierName) {
        this.supplierName = supplierName;
    }

    public long getGoodsNumber() {
        return goodsNumber;
    }

    public void setGoodsNumber(long goodsNumber) {
        this.goodsNumber = goodsNumber;
    }

    public double getGoodsPrice() {
        return goodsPrice;
    }

    public void setGoodsPrice(double goodsPrice) {
        this.goodsPrice = goodsPrice;
    }

    public double getTotalCost() {
        return totalCost;
    }

    public void setTotalCost(double totalCost) {
        this.totalCost = totalCost;
    }

    public int getState() {
        return state;
    }

    public String getStateStr() {
        if (STATE_SUBMIT == state) {
            return "已提交，待审批";
        } else if (STATE_APPROVE == state) {
            return "已审批，待审核";
        } else if (STATE_COMPLETE == state) {
            return "已通过";
        } else {
            return "";
        }
    }

    public void setState(int state) {
        this.state = state;
    }

}
